package com.shangke.corejava.ch13;

//封装
public class Test1 extends Thread {
	private int begin;
	private int end;

	public Test1() {
		super();
	}

	public Test1(int max, int min) {
		super();
		this.begin = max;
		this.end = min;
	}

	public int getMax() {
		return begin;
	}

	public void setMax(int max) {
		this.begin = max;
	}

	public int getMin() {
		return end;
	}

	public void setMin(int min) {
		this.end = min;
	}

	// 重写方法
	@Override
	public void run() {
		for (int i = begin; i <= end; i++) {
			int j = 2;
			for (j = 2; j <= i; j++) {
				if (i % j == 0) {
					break;
				}
			}
			if (i == j) {
				System.out.println(i);
			}
		}
	}

	// 调用
	public static void main(String[] args) {
		Test1 test1 = new Test1(1, 1000);
		test1.start();

		Test1 test2 = new Test1(1001, 2000);
		test2.start();

		Test1 test3 = new Test1(2001, 3000);
		test3.start();

	}

}
